Improve error messages for X errors and losing connection to the X server.
authorHavoc Pennington <hp@pobox.com>
Sun, 20 May 2001 22:48:40 +0000 (22:48 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Sun, 20 May 2001 22:48:40 +0000 (22:48 +0000)
2001-05-11  Havoc Pennington  <hp@pobox.com>

* gdk/x11/gdkmain-x11.c: Improve error messages for X errors and
losing connection to the X server.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/reference/gtk/tmpl/gtkrc.sgml
gdk/x11/gdkmain-x11.c

index 914a8c2dd5f9c3f15643666355cb7373d4e6316c..a43e82dc27f804576437b4ffa70a1a2be03c752c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-05-11  Havoc Pennington  <hp@pobox.com>
+       
+       * gdk/x11/gdkmain-x11.c: Improve error messages for X errors and
+       losing connection to the X server.
+
 Sun May 20 13:59:20 2001  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Start checks for X from pangox/pangoxft
index 914a8c2dd5f9c3f15643666355cb7373d4e6316c..a43e82dc27f804576437b4ffa70a1a2be03c752c 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-11  Havoc Pennington  <hp@pobox.com>
+       
+       * gdk/x11/gdkmain-x11.c: Improve error messages for X errors and
+       losing connection to the X server.
+
 Sun May 20 13:59:20 2001  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Start checks for X from pangox/pangoxft
index 914a8c2dd5f9c3f15643666355cb7373d4e6316c..a43e82dc27f804576437b4ffa70a1a2be03c752c 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-11  Havoc Pennington  <hp@pobox.com>
+       
+       * gdk/x11/gdkmain-x11.c: Improve error messages for X errors and
+       losing connection to the X server.
+
 Sun May 20 13:59:20 2001  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Start checks for X from pangox/pangoxft
index 914a8c2dd5f9c3f15643666355cb7373d4e6316c..a43e82dc27f804576437b4ffa70a1a2be03c752c 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-11  Havoc Pennington  <hp@pobox.com>
+       
+       * gdk/x11/gdkmain-x11.c: Improve error messages for X errors and
+       losing connection to the X server.
+
 Sun May 20 13:59:20 2001  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Start checks for X from pangox/pangoxft
index 914a8c2dd5f9c3f15643666355cb7373d4e6316c..a43e82dc27f804576437b4ffa70a1a2be03c752c 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-11  Havoc Pennington  <hp@pobox.com>
+       
+       * gdk/x11/gdkmain-x11.c: Improve error messages for X errors and
+       losing connection to the X server.
+
 Sun May 20 13:59:20 2001  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Start checks for X from pangox/pangoxft
index 914a8c2dd5f9c3f15643666355cb7373d4e6316c..a43e82dc27f804576437b4ffa70a1a2be03c752c 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-11  Havoc Pennington  <hp@pobox.com>
+       
+       * gdk/x11/gdkmain-x11.c: Improve error messages for X errors and
+       losing connection to the X server.
+
 Sun May 20 13:59:20 2001  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Start checks for X from pangox/pangoxft
index 914a8c2dd5f9c3f15643666355cb7373d4e6316c..a43e82dc27f804576437b4ffa70a1a2be03c752c 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-11  Havoc Pennington  <hp@pobox.com>
+       
+       * gdk/x11/gdkmain-x11.c: Improve error messages for X errors and
+       losing connection to the X server.
+
 Sun May 20 13:59:20 2001  Owen Taylor  <otaylor@redhat.com>
 
        * configure.in: Start checks for X from pangox/pangoxft
index aeceb3e5ec5128ed4fb5e158a0cdbac4c0421aeb..88a0a4a50768b9125a3501db571c351823709144 100644 (file)
@@ -495,6 +495,7 @@ This can later be composited together with other
 #GtkRcStyle structures to form a #GtkStyle.
 </para>
 
+@parent_instance: 
 @name: 
 @bg_pixmap_name: 
 @font_desc: 
index 1773f761cc360ddcd42c5e6acbdb22c0c5438e0c..607483402466bcc2f1158e4477484739cebad626 100644 (file)
@@ -617,24 +617,32 @@ gdk_x_error (Display       *display,
     {
       if (gdk_error_warnings)
        {
-         char buf[64];
-         
+         gchar buf[64];
+          gchar *msg;
+          
          XGetErrorText (display, error->error_code, buf, 63);
 
+          msg =
+            g_strdup_printf ("The program '%s' received an X Window System error.\n"
+                             "This probably reflects a bug in the program.\n"
+                             "The error was '%s'.\n"
+                             "  (Details: serial %ld error_code %d request_code %d minor_code %d)\n"
+                             "  (Note to programmers: normally, X errors are reported asynchronously;\n"
+                             "   that is, you will receive the error a while after causing it.\n"
+                             "   To debug your program, run it with the --sync command line\n"
+                             "   option to change this behavior. You can then get a meaningful\n"
+                             "   backtrace from your debugger if you break on the gdk_x_error() function.)",
+                             g_get_prgname (),
+                             buf,
+                             error->serial, 
+                             error->error_code, 
+                             error->request_code,
+                             error->minor_code);
+          
 #ifdef G_ENABLE_DEBUG    
-         g_error ("%s\n  serial %ld error_code %d request_code %d minor_code %d\n", 
-                  buf, 
-                  error->serial, 
-                  error->error_code, 
-                  error->request_code,
-                  error->minor_code);
+         g_error ("%s", msg);
 #else /* !G_ENABLE_DEBUG */
-         fprintf (stderr, "Gdk-ERROR **: %s\n  serial %ld error_code %d request_code %d minor_code %d\n",
-                  buf, 
-                  error->serial, 
-                  error->error_code, 
-                  error->request_code,
-                  error->minor_code);
+         fprintf (stderr, "%s\n", msg);
 
          exit(1);
 #endif /* G_ENABLE_DEBUG */
@@ -675,11 +683,17 @@ gdk_x_io_error (Display *display)
    */
   if (errno == EPIPE)
     {
-      fprintf (stderr, "Gdk-ERROR **: X connection to %s broken (explicit kill or server shutdown).\n", gdk_display ? DisplayString (gdk_display) : gdk_get_display());
+      fprintf (stderr,
+               "The application '%s' lost its connection to the display %s;\n"
+               "most likely the X server was shut down or you killed/destroyed\n"
+               "the application.\n",
+               g_get_prgname (),
+               gdk_display ? DisplayString (gdk_display) : gdk_get_display());
     }
   else
     {
-      fprintf (stderr, "Gdk-ERROR **: Fatal IO error %d (%s) on X server %s.\n",
+      fprintf (stderr, "%s: Fatal IO error %d (%s) on X server %s.\n",
+               g_get_prgname (),
               errno, g_strerror (errno),
               gdk_display ? DisplayString (gdk_display) : gdk_get_display());
     }